package com.atguigu.springcloud.alibaba.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@Slf4j
public class FlowLimitController {

    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("/testA")
    public String testA() {
        String object = restTemplate.getForObject("http://localhost:8401/testB", String.class);
        return "------testA" + object;
    }

    @GetMapping("/testB")
    public String testB() throws InterruptedException {
        log.info(Thread.currentThread().getName() + "------testB");
        return "------testB";
    }


    @GetMapping("/test/rongduan")
    public String testrongduan() throws InterruptedException {
        log.info(Thread.currentThread().getName() + "------rongduan");
        int i = 10 / 0;
        Thread.sleep(500);
        return "------rongduan";
    }
}
